<?php 
global $_GPC, $_W;
$shopid=check_right(0,0);
if(!$shopid)message("请先选择需要管理的店铺",$this->createWebUrl('shop'),'error');
$shop=pdo_fetch("SELECT * FROM ".tablename('j_hmoney_group')." WHERE weid = '{$_W['uniacid']}' and id='".$shopid."'");
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
$cfg = $this->module['config'];
load()->model('mc');

if($operation=="display"){
	$todayItem=pdo_fetch("SELECT count(*) as num1,sum(paid_fee) as fee FROM ".tablename('j_hmoney_order')." WHERE groupid=:a and ispay=1 and createdate='".date("Y-m-d")."'",array(":a"=>$shopid));
	$yesterdayItem=pdo_fetch("SELECT count(*) as num1,sum(paid_fee) as fee FROM ".tablename('j_hmoney_order')." WHERE groupid=:a and ispay=1 and createdate='".date("Y-m-d",strtotime('-1 day'))."'",array(":a"=>$shopid));
	
	$charge_today=pdo_fetch("SELECT sum(cash) as fee FROM ".tablename('j_hmoney_recharge')." WHERE groupid=:a and status=1 and usetype=0 and createdate='".date("Y-m-d")."'",array(":a"=>$shopid));
	$charge_yesterday=pdo_fetch("SELECT sum(cash) as fee FROM ".tablename('j_hmoney_recharge')." WHERE groupid=:a and status=1 and createdate='".date("Y-m-d",strtotime('-1 day'))."' and usetype=0 ",array(":a"=>$shopid));
	
	$list=pdo_fetchall("SELECT createdate,count(*) as num1,sum(paid_fee) as fee FROM ".tablename('j_hmoney_order')." WHERE groupid=:a and ispay=1 and createdate>='".date("Y-m-d",strtotime('-6 day'))."' group by createdate order by createdate asc",array(":a"=>$shopid));

	$tempAry=array();
	$dayList=array();
	$numlist=array();
	$feelist=array();

	foreach($list as $row){
		$dayList[]=date('m-d',strtotime($row['createdate']));
		$numlist[]=$row['num1'];
		$feelist[]=$this->_2money($row['fee']);
	}
	$dayStr=implode(',',$dayList);
	$numstr=implode(',',$numlist);
	$feestr=implode(',',$feelist);
} elseif ($operation == 'post') {
	
}elseif ($operation == 'logout') {
	$url=$_W['siteroot']."app/index.php?i=".$_W['uniacid']."&c=entry&do=index&m=j_hmoney";
	isetcookie('__session', '', -10000);
	header('Location:' . $url);
}

include $this->template('web/'.$cfg['floder'].'/index');